package com.guchenbo.lssp.support;

import java.util.Map;

/**
 * livy配置
 */
public class LivyProperties {
    /**
     * livy session配置
     */
    private SessionConf sessionConf;
    /**
     * livy 重试配置
     */
    private LivyRetryConf livyRetryConf;

    public SessionConf getSessionConf() {
        return sessionConf;
    }

    public void setSessionConf(SessionConf sessionConf) {
        this.sessionConf = sessionConf;
    }

    public LivyRetryConf getLivyRetryConf() {
        return livyRetryConf;
    }

    public void setLivyRetryConf(LivyRetryConf livyRetryConf) {
        this.livyRetryConf = livyRetryConf;
    }

    public static class SessionConf {
        /**
         * 队列
         */
        private String queue;
        /**
         * 额外配置
         */
        private Map<String, String> conf;

        public String getQueue() {
            return queue;
        }

        public void setQueue(String queue) {
            this.queue = queue;
        }

        public Map<String, String> getConf() {
            return conf;
        }

        public void setConf(Map<String, String> conf) {
            this.conf = conf;
        }
    }

    public static class LivyRetryConf {
        /**
         * 创建session的重试次数
         */
        private int sessionMaxAttempts = 30;
        /**
         * 创建session的重试间隔毫秒
         */
        private long sessionRetryTime = 5000L;
        /**
         * statement就绪的重试次数
         */
        private int statementMaxAttempts = 30;
        /**
         * statement就绪的重试间隔毫秒
         */
        private long statementRetryTime = 800L;

        public int getSessionMaxAttempts() {
            return sessionMaxAttempts;
        }

        public void setSessionMaxAttempts(int sessionMaxAttempts) {
            this.sessionMaxAttempts = sessionMaxAttempts;
        }

        public long getSessionRetryTime() {
            return sessionRetryTime;
        }

        public void setSessionRetryTime(long sessionRetryTime) {
            this.sessionRetryTime = sessionRetryTime;
        }

        public int getStatementMaxAttempts() {
            return statementMaxAttempts;
        }

        public void setStatementMaxAttempts(int statementMaxAttempts) {
            this.statementMaxAttempts = statementMaxAttempts;
        }

        public long getStatementRetryTime() {
            return statementRetryTime;
        }

        public void setStatementRetryTime(long statementRetryTime) {
            this.statementRetryTime = statementRetryTime;
        }
    }
}
